package com.ssy.lingxi.product.entity.commodity.member;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 商品会员
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/1/11
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "product_commodity_member")
public class CommodityMember implements Serializable {
    private static final long serialVersionUID = -3336955683521647917L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="commodity_member_seq")
    @SequenceGenerator(sequenceName="product_commodity_member_seq", name="commodity_member_seq",allocationSize = 1)
    private Long id;

    /**
     * 商品价格策略
     */
    @JsonIgnore
    @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
    @JoinColumn(name="commodityUnitPriceStrategyId",referencedColumnName = "id")
    private CommodityUnitPriceStrategy commodityUnitPriceStrategy;

    /**
     * 会员id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberId;

    /**
     * 会员名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String memberName;

    /**
     * 会员类型名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String memberTypeName;

    /**
     * 会员角色id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberRoleId;

    /**
     * 会员角色名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String memberRoleName;

}
